﻿$(document).ready(function () {
   // $("#lstProducts").bind("touchstart mousedown", function (e) {
   //     alert('Selected Name=' + $(this).attr('data-name'));
   // });
    //// $("#btnCancel").bind("click", btnCancel_click);  navbarcreate
})

function get()
{
    alert("ddd");
    return false;
}

//立即购买
function btnBuy_click(e)
{
    var btnBuy = $(e);
    var strProduct = btnBuy.attr("name");
    var pId = strProduct.substring(strProduct.lastIndexOf("_") + 1, strProduct.length);
    $.post("/WeiXin/AddToShoppingCar", { productId: pId }, function (result) {
        if (result == "OK") {
            window.location.href = "/WeiXin/Order";
        }
        else {
            alert("添加失败，请稍后重试!");
        }
    });
}

//加入购物车
function btnAddToCar_click(e) {
    var btnBuy = $(e);
    var strProduct = btnBuy.attr("name");
    var pId = strProduct.substring(strProduct.lastIndexOf("_") + 1, strProduct.length);
    $.post("/WeiXin/AddToShoppingCar", { productId: pId }, function (result) {
        if (result == "OK") {
            alert("添加成功!");          
        }
        else {
            alert("添加失败，请稍后重试!");
        }
    });
}
